﻿/* DotNetHoldem 
 * .Net Solution that allows to use OpenHoldem with .Net logic
 * Author: Óscar Andreu
 * oesido at gmail dot com
 * Licensed under GPLv3 - 2012
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetBotLogic.Enums;

namespace DotNetBotLogic.Classes.PlayHistory
{
    internal class Player
    {

        #region Variables

        #region Statistics

        /// <summary>
        /// Voluntarily put money in the pot
        /// </summary>
        internal int sta_VP_IP;
        /// <summary>
        /// Preflop Raise
        /// </summary>
        internal double sta_PFR;
        /// <summary>
        /// 3-Bet Preflop
        /// </summary>
        internal int sta_3B; 
        /// <summary>
        /// Fold to 3-bet PF
        /// </summary>
        internal int sta_F3B; 
        /// <summary>
        /// Attempt to steal
        /// </summary>
        internal int sta_ATS;  
        /// <summary>
        /// Fold big blind to steal
        /// </summary>
        internal int sta_FBS;  
        /// <summary>
        /// C-Bet Flop
        /// </summary>
        internal int sta_CB;  
        /// <summary>
        /// Fold to Turn C-Bet
        /// </summary>
        internal int sta_FC;  
        /// <summary>
        /// River aggression factor
        /// </summary>
        internal int sta_FA;  
        /// <summary>
        /// River aggression factor
        /// </summary>
        internal int sta_TA; 
        /// <summary>
        /// River aggression factor
        /// </summary>
        internal int sta_RA; 

        #endregion

        private int PreflopFolds = 0;
        private int FlopFolds = 0;
        private int TurnFolds = 0;
        private int RiverFolds = 0;
        private bool fold = false;
        internal bool Fold
        {
            get { return fold; }
        }

        internal int PFF = 0; //PF Fold
        internal int PFR = 0; //PF raise
        internal int PFC = 0; //PF call
        internal int VP_IP;
        internal int _3B; //PF 3-bets
        internal int _4B; //PF 3-bets
        internal int PF_Alli; //PF Alli
        internal int PF_FoldAlli; //PF folds Alli
        internal int F3B; //Fold 3-b
        internal int ATS;
        internal int FBS;
        internal int CB;
        internal int FCA;
        internal int FA;
        internal int TA;
        internal int RA; 

        internal double Winloss { get; set; }
        internal string Name { get; set; }
        internal int HandsPlayed { get; set; }
        internal int CurrentChair { get; set; }
        internal int DealPosition { get; set; }

        private double balance;
        internal double Balance 
        {
            get
            {
                return balance;
            }
            set
            {
                if (oldBalance != 0)
                    Winloss += balance - oldBalance;
                else
                    oldBalance = balance;

                balance = value;
            }
        }

        private double oldBalance = 0;

        #endregion

        #region Constructor

        internal Player(string name)
        {
            this.Name = name;
        }

        #endregion

        #region Methods

        internal void SetFold(BetRounds round)
        {
            if (!fold)
            {
                if (round == BetRounds.Preflop)
                {
                    PreflopFolds++;
                }
                else if (round == BetRounds.Flop)
                {
                    FlopFolds++;
                }
                else if (round == BetRounds.Turn)
                {
                    TurnFolds++;
                }
                else if (round == BetRounds.River)
                {
                    RiverFolds++;
                }
            }
            fold = true;
        }

        internal void Clear()
        {
            DealPosition = -1;
            fold = false;
        }

        #endregion


    }
}

